package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ToastUtils;
import com.lxj.xpopup.core.CenterPopupView;
import com.seuic.hnjiningposapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class DrawMoneyNumPopup extends CenterPopupView {//输入取款金额弹窗
    Context context;
    Activity activity;
    Unbinder bind;
    ClickCallback callevent;
    @BindView(R.id.import_moneynum_edtext)
    EditText importMoneynumEdtext;
    @BindView(R.id.import_moneynum_gz)
    Button importMoneynumGz;
    @BindView(R.id.import_moneynum_ok)
    Button importMoneynumOk;
    @BindView(R.id.import_moneynum_layout)
    LinearLayout importMoneynumLayout;


    public DrawMoneyNumPopup(@NonNull Context context, Activity activity, ClickCallback callevent) {
        super(context);
        this.context = context;
        this.activity = activity;
        this.callevent = callevent;
    }

    public interface ClickCallback {
        void SendDrawMoneyNum(String money);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_drawmoneynum;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);
    }

    @OnClick({R.id.import_moneynum_gz, R.id.import_moneynum_ok,})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.import_moneynum_gz:
                importMoneynumEdtext.setText("");
                break;
            case R.id.import_moneynum_ok:
                if (importMoneynumEdtext.getText().toString().equals("")) {
                    ToastUtils.showLong("请输入金额");
                    return;
                } else {
                    callevent.SendDrawMoneyNum(importMoneynumEdtext.getText().toString());
                }
                break;
        }
    }

    protected void onShow() {
        super.onShow();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }
}